import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
%matplotlib inline
df = pd.read_csv('data/ne_populated_places.csv')
gdf = gpd.GeoDataFrame(
df,
geometry=df.apply(lambda row: Point(row['longitude'], row['latitude']),axis=1),
crs=4326
)
gdf.plot()
from cartoframes.data import Dataset
from cartoframes.viz import Map, Layer
df = pd.read_csv('data/ne_populated_places.csv')
Map(Layer(Dataset(df)))
gdf = gpd.read_file('data/ne_countries.gpkg')
gdf.plot()
We'll add a popup to the Layer to show the country's name.
gdf = gpd.read_file('data/ne_countries.gpkg')
Map(
Layer(
Dataset(gdf),
popup={'hover': '$NAME'}
)
)